package cn.xej.miniuiDemo.service.impl;

import cn.xej.miniuiDemo.common.RespObj;
import cn.xej.miniuiDemo.mapper.UserMapper;
import cn.xej.miniuiDemo.pojo.User;
import cn.xej.miniuiDemo.service.UserService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public RespObj users() {
        Page<User> page = new Page<>();
        page.setCurrent(1);
        page.setSize(5);
        IPage<User> userIPage = userMapper.selectPage(page, null);
        List<User> userList = userIPage.getRecords();
        return RespObj.succ(200,userList);
    }


    @Override
    public List<User> users1() {
        Page<User> page = new Page<>();
        page.setCurrent(1);
        page.setSize(5);
        IPage<User> userIPage = userMapper.selectPage(page, null);
        List<User> userList = userIPage.getRecords();
        return userList;
    }
}
